Release 10.1A: OpenEdge Development:
Programming Interfaces
Parsing with one call or with multiple calls
A Progress SAX application can parse an XML document using one of the following techniques:
To use the single-call technique, the application calls the
SAX-PARSE()method once. The parser parses the entire XML document (unless errors occur), calling all appropriate callbacks, and returns control to the line in the code followingSAX-PARSE().To use the progressive-scan technique, the application calls the
SAX-PARSE-FIRST()method once to initiate parsing, then calls theSAX-PARSE-NEXT()method repeatedly to parse each XML token in the document. As each XML token is detected, Progress invokes the corresponding callback. After each call toSAX-PARSE-FIRST()orSAX-PARSE-NEXT(), control returns to the line in the code following theSAX-PARSE-FIRST()orSAX-PARSE-NEXT().Consider using progressive scan:
- If your business logic is complex and processes individual XML elements extensively.
To do significant processing with single call, your callback code might have to call directly into your business logic. This might be awkward — especially adding SAX to existing code.
To do significant processing with progressive scan, your business logic can simply call
SAX-PARSE-FIRST()orSAX-PARSE-NEXT()to extract the next piece of data. The callbacks would simply store incoming data, one piece at a time, for the business logic to process after the return fromSAX-PARSE-FIRST()orSAX-PARSE-NEXT().- To parse two XML sources concurrently.
After calling
SAX-PARSE(),SAX-PARSE-FIRST(), orSAX-PARSE-NEXT(), the application checks the value of thePARSE-STATUSattribute, as explained in the "Monitoring the state of the parse" section.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |